﻿//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NetCMS.Content;

public partial class manage_channel_style_classlist : NetCMS.Web.UI.ManagePage
{
    Channel rd = new Channel();
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.CacheControl = "no-cache";
        if (!IsPostBack)
        {
            if (SiteID != "0")
            {
                PageError("分站没权限操作", "javascript:history.back();", true);
            }
            copyright.InnerHtml = CopyRight;
            string ChID = Request.QueryString["ChID"];
            if (ChID != null && ChID != string.Empty)
            {
                GetStyleClass(int.Parse(ChID.ToString()));
            }
            else
            {
                PageError("错误的频道ID", "javascript:history.back();", true);
            }
        }
    }

    protected void GetStyleClass(int ChID)
    {
        string liststr = "<div><ul>";
        Channel rd = new Channel();
        IDataReader dr = rd.GetStyleClassListManage(ChID,0);
        while (dr.Read())
        {
            liststr += "<li><input type=\"checkbox\" name=\"infoID\" value=\"" + dr["id"].ToString() + "\" /><a class=\"list_link\" href=\"style_classAdd.aspx?ChID=" + ChID + "&id=" + dr["id"].ToString() + "&Action=Edit\">" + dr["cName"].ToString() + "</a></li>";
        }
        dr.Close();
        classlist.InnerHtml = liststr+"</ul></div>";
    }

    protected void delContent(object sender, EventArgs e)
    {
        string Str = Request.Form["infoID"];
        if (Str == null || Str == String.Empty)
        {
            PageError("请至少选择一项!", "");
        }
        else
        {
            string[] gIDARR = Str.Split(',');
            Str = null;
            int j = 0;
            int m = 0;
            for (int i = 0; i < gIDARR.Length; i++)
            {
                if (rd.delStyleClassContent(int.Parse(gIDARR[i]), int.Parse(Request.QueryString["ChID"])) != 0)
                {
                    j++;
                }
                else
                {
                    m++;
                }
            }
            PageRight("成功删除" + j + "个栏目!,失败" + m + "个栏目。", "javascript:history.back();", true);
        }
    }
}
